﻿using UnityEngine;
using System.Collections;

public class CrumbleOnhit : MonoBehaviour
{

	private AudioSource audio;
	
	// Use this for initialization
	void Start ()
	{
		audio= GetComponent<AudioSource>();
	}
	
	// Update is called once per frame
	void Update ()
	{
	
	}

	void OnCollisionEnter2D (Collision2D coll)
	{
		Animator animator = this.GetComponent<Animator> () as Animator;
	
		audio.Play();
		animator.SetBool ("crumble", true);
		
	}
		
	public void DestroyPlateform ()
	{
		Destroy (this.gameObject);
	}
}
